//By Trait: New Retail的item，TRAIT_STORE_NBR，RETAIL_TYPE一样，时间有重叠，则重复提示
var result_3 = JSON.parse('{"CODE":0, "ACTION":"","LEVEL":"", "MSG":"","DATA":"","RULE":"3"}');
//var JSON_ITEM_LIST = !isNull(ITEM_LIST) ? JSON.parse(ITEM_LIST) : [];
//var EFF_DATE = new Date(NEW_RETAIL_EFF_DATE);
//var EXP_DATE = new Date(NEW_RETAIL_EXP_DATE);

function FindSameRetail(ITEM_NBR, ID, TRAIT_STORE_NBR, RETAIL_TYPE, NEW_RETAIL_EFF_DATE, NEW_RETAIL_EXP_DATE, NEW_RETAIL, JSON_ITEM_LIST) {
  for (var i = 0; i < JSON_ITEM_LIST.length; i++) {
    if (RetailIsNotNull(JSON_ITEM_LIST[i])
      && ITEM_NBR == JSON_ITEM_LIST[i].ITEM_NBR
      && ID != JSON_ITEM_LIST[i].ID
      && TRAIT_STORE_NBR == JSON_ITEM_LIST[i].TRAIT_STORE_NBR
      && RETAIL_TYPE == JSON_ITEM_LIST[i].RETAIL_TYPE
      && isDateIntersection(EFF_DATE, EXP_DATE, new Date(JSON_ITEM_LIST[i].NEW_RETAIL_EFF_DATE), new Date(JSON_ITEM_LIST[i].NEW_RETAIL_EXP_DATE))) {
      return true;
    }
  }
  return false;
};

if (TRAIT_STORE_FLAG == "T"
  && FindSameRetail(ITEM_NBR, ID, TRAIT_STORE_NBR, RETAIL_TYPE, NEW_RETAIL_EFF_DATE, NEW_RETAIL_EXP_DATE, NEW_RETAIL, JSON_ITEM_LIST)) {
    result_3.CODE = 2;
    result_3.ACTION = "CHECKING_REPORT";
    result_3.MSG = "此条重复";
} 
JSON.stringify(result_3);
